/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.bitacora.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Etts
 */
@Entity
@Table(name = "carros")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Carros.findAll", query = "SELECT c FROM Carros c"),
    @NamedQuery(name = "Carros.findByIdCarros", query = "SELECT c FROM Carros c WHERE c.idCarros = :idCarros"),
    @NamedQuery(name = "Carros.findByMatricula", query = "SELECT c FROM Carros c WHERE c.matricula = :matricula"),
    @NamedQuery(name = "Carros.findByColor", query = "SELECT c FROM Carros c WHERE c.color = :color"),
    @NamedQuery(name = "Carros.findByFabricante", query = "SELECT c FROM Carros c WHERE c.fabricante = :fabricante"),
    @NamedQuery(name = "Carros.findByTipo", query = "SELECT c FROM Carros c WHERE c.tipo = :tipo"),
    @NamedQuery(name = "Carros.findDuplicity", query = "SELECT c FROM Carros c WHERE c.matricula = :matricula")
})
public class Carros implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCarros")
    private Integer idCarros;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 8)
    @Column(name = "Matricula")
    private String matricula;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Color")
    private String color;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Fabricante")
    private String fabricante;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Tipo")
    private String tipo;
    @OneToMany(mappedBy = "carrosidCarros")
    private List<Salida> salidaList;
    @OneToMany(mappedBy = "carrosidCarros")
    private List<Entrada> entradaList;

    public Carros() {
    }

    public Carros(Integer idCarros) {
        this.idCarros = idCarros;
    }

    public Carros(Integer idCarros, String matricula, String color, String fabricante, String tipo) {
        this.idCarros = idCarros;
        this.matricula = matricula;
        this.color = color;
        this.fabricante = fabricante;
        this.tipo = tipo;
    }

    public Integer getIdCarros() {
        return idCarros;
    }

    public void setIdCarros(Integer idCarros) {
        this.idCarros = idCarros;
    }

    public String getMatricula() {
        return matricula;
    }

    public void setMatricula(String matricula) {
        this.matricula = matricula;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getFabricante() {
        return fabricante;
    }

    public void setFabricante(String fabricante) {
        this.fabricante = fabricante;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    @XmlTransient
    public List<Salida> getSalidaList() {
        return salidaList;
    }

    public void setSalidaList(List<Salida> salidaList) {
        this.salidaList = salidaList;
    }

    @XmlTransient
    public List<Entrada> getEntradaList() {
        return entradaList;
    }

    public void setEntradaList(List<Entrada> entradaList) {
        this.entradaList = entradaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCarros != null ? idCarros.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Carros)) {
            return false;
        }
        Carros other = (Carros) object;
        if ((this.idCarros == null && other.idCarros != null) || (this.idCarros != null && !this.idCarros.equals(other.idCarros))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return ""+idCarros ;
    }
    
}
